package com.cat.greedyAlgorithm;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * @author 曲大人的喵
 * @description https://leetcode.cn/problems/maximum-median-sum-of-subsequences-of-size-3/description/
 * @create 2025/8/21 09:46
 * @since JDK17
 */

public class Solution02 {
    public long maximumMedianSum(int[] nums) {
        Arrays.sort(nums);
        long ans = 0;
        int n = nums.length, s = n / 3;
        for (int i = n - 2; i >= s; i -= 2) {
            ans += nums[i];
        }
        return ans;
    }
}
